﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ScreenTranslate
{
    /// <summary>
    /// 窗口类型枚举
    /// </summary>
    public enum FormType
    {
        Form1,
        Login
    }

    public class Center
    {
        private static Center instance;
        public static Center Instance
        {
            get
            {
                if(instance == null)
                {
                    instance = new Center();
                }
                return instance;
            }
        }

        /// <summary>
        /// 存放所有的窗口
        /// </summary>
        public Dictionary<FormType,Form> forms = new Dictionary<FormType, Form>();
        /// <summary>
        /// 当前窗口
        /// </summary>
        private FormType currentForm = FormType.Login;

        public void ChangePanel(FormType formType)
        {
            forms[currentForm].Hide();
            forms[formType].Show();
            currentForm = formType;
        }

        public void ShowMainPanel()
        {
            if(forms[ FormType.Login] != null)
            {
                forms[FormType.Login].Show();
            }
        }
    }
}
